package avicit.bdp.dcs.rule.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * @金航数码科技有限责任公司
 * @作者：liyb
 * @邮箱：liyb@avic-digital.com
 * @创建时间：2020-08-06 10:49
 * @类说明：数据迁移同步批量修改表名规则实体类
 * @修改记录：
 */
@ApiModel(value = "TableRuleDTO", description = "bdp_dcs_table_rule")
@Table(name = "bdp_dcs_table_rule")
public class TableRuleDTO extends BaseDTO {

    private static final long serialVersionUID = 1L;

    // 主键
    @Id
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "id")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    // 迁移id，同步id
    @LogField
    @ApiModelProperty(value = "迁移id，同步id")
    @FieldRemark(column = "job_id", field = "jobId", name = "迁移或同步ID")
    @Column(name = "job_id")
    private String jobId;

    // 批量修改表名的选择范围，部分表：0，全部表：1
    @LogField
    @ApiModelProperty(value = "批量修改表名的选择范围，部分表：0，全部表：1")
    @FieldRemark(column = "all_table", field = "allTable", name = "批量修改表名的选择范围")
    @Column(name = "all_table")
    private Integer allTable;

    // 表名,多个逗号分隔
    @LogField
    @ApiModelProperty(value = "表名,多个逗号分隔")
    @FieldRemark(column = "table_name", field = "tableName", name = "表名")
    @Column(name = "table_name")
    private String tableName;

    // 规则类型，添加前后缀：1，更名：2
    @LogField
    @ApiModelProperty(value = "规则类型，添加前后缀：1，更名：2")
    @FieldRemark(column = "rule_type", field = "ruleType", name = "规则类型")
    @Column(name = "rule_type")
    private Integer ruleType;

    // 规则名称：修改规则1，修改规则2....
    @LogField
    @ApiModelProperty(value = "规则名称：修改规则1，修改规则2....")
    @FieldRemark(column = "name", field = "name", name = "规则名称")
    @Column(name = "name")
    private String name;

    // 前缀
    @LogField
    @ApiModelProperty(value = "前缀")
    @FieldRemark(column = "prefix", field = "prefix", name = "前缀")
    @Column(name = "prefix")
    private String prefix;

    // 后缀
    @LogField
    @ApiModelProperty(value = "后缀")
    @FieldRemark(column = "suffix", field = "suffix", name = "后缀")
    @Column(name = "suffix")
    private String suffix;

    // 更名
    @LogField
    @ApiModelProperty(value = "更名")
    @FieldRemark(column = "new_name", field = "newName", name = "更名")
    @Column(name = "new_name")
    private String newName;

    // 组织机构代码
    @ApiModelProperty(value = "组织机构代码")
    @FieldRemark(column = "org_identity", field = "orgIdentity", name = "组织机构代码")
    @Column(name = "org_identity")
    private String orgIdentity;

    // 密级
    @ApiModelProperty(value = "密级")
    @FieldRemark(column = "secret_level", field = "secretLevel", name = "密级")
    @Column(name = "secret_level")
    private String secretLevel;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public Integer getAllTable() {
        return allTable;
    }

    public void setAllTable(Integer allTable) {
        this.allTable = allTable;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public Integer getRuleType() {
        return ruleType;
    }

    public void setRuleType(Integer ruleType) {
        this.ruleType = ruleType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public String getNewName() {
        return newName;
    }

    public void setNewName(String newName) {
        this.newName = newName;
    }

    @Override
    public String getOrgIdentity() {
        return orgIdentity;
    }

    @Override
    public void setOrgIdentity(String orgIdentity) {
        this.orgIdentity = orgIdentity;
    }

    @Override
    public String getSecretLevel() {
        return secretLevel;
    }

    @Override
    public void setSecretLevel(String secretLevel) {
        this.secretLevel = secretLevel;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "表规则管理";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "表规则";
        } else {
            return super.logTitle;
        }
    }

}